﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.Utilities;
using Microsoft.Build.Framework;
using System.Globalization;
using System.IO;
using System.Reflection;

namespace SPALM
{
	/// <summary>
	/// Checks conditions e.g. to be used before a deployment
	/// </summary>
	public class UserInput : Task
	{
		public string UserPrompt { get; set; }

		public string Title { get; set; }

		[Output]
		public string UserResponse { get; set; }

		public override bool Execute()
		{
			ReadLine(); 			
			return true;
		}

		private void ReadLine()
		{
			if (string.IsNullOrEmpty(this.UserPrompt))
			{
				this.UserPrompt = "Please enter a response and press [Enter]:";
			}

			Log.LogMessageFromText(this.UserPrompt, MessageImportance.High);
			this.UserResponse = System.Console.ReadLine();
		}
	}
}
